package com.abc.cloud.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.abc.cloud.entity.SysConfigEntity;
import com.abc.cloud.service.SysConfigService;
import com.abc.cloud.common.utils.PageUtil;
import com.abc.cloud.common.utils.Result;



/**
 * 系统配置表
 *
 * @author LiJunXi
 * @email 2770063826@qq.com
 * @date 2023-10-27 13:09:54
 */
@RestController
@RequestMapping("/sysConfig")
public class SysConfigController {
    @Autowired
    private SysConfigService sysConfigService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(){
        List<SysConfigEntity> page = sysConfigService.queryAll();

        return Result.success(page, "操作成功");
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Long id){
		SysConfigEntity sysConfig = sysConfigService.getById(id);

        return Result.success(sysConfig, "sysConfig");
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result save(@RequestBody SysConfigEntity sysConfig){
		sysConfigService.save(sysConfig);

        return Result.success(null, "操作成功");
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public Result update(@RequestBody List<SysConfigEntity> sysConfigList){
		sysConfigService.updateSysConfigList(sysConfigList);

        return Result.success(null, "操作成功");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
		sysConfigService.removeByIds(Arrays.asList(ids));

        return Result.success(null, "");
    }

}
